<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>0</h1>
<script>
    let c=0;
    let h=document.querySelector("h1");
    setInterval(f,1000);
    function f() {
        c++;
        h.innerText=c;
    }
    let timer=setInterval(function () {
        console.log(c);
        if(c==5){
            clearInterval(timer);
        }
    },1000);
    setTimeout(function () {
        alert("午时已到")
    },3000);
</script>
</body>
</html>